<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<jsp:directive.page import="com.db.BaseDAO"/>




<%
String path = request.getContextPath();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
		<meta http-equiv="description" content="This is my page" />

		<link rel="stylesheet" type="text/css" href="<%=path%>/css/base.css" />
        <script>
          function check(){
            var reg = /^\d+$/gi;
            var regx = /^[\u4e00-\u9fa5]{2,4}$/gi;
           
            var regs = /^\d+$/gi;
            var regz = /^\d+$/gi;
           
            
            var stuno = document.getElementById("stuno").value;
            var name = document.getElementById("name").value;
          
            var tel = document.getElementById("tel").value;
            var roomno = document.getElementById("roomno").value;
            
            
            
            if(!reg.test(stuno)){
               alert("请输入正确的学号");
               return false;
            }
            if(!regx.test(name)){
               alert("请输入正确的姓名");
               return false;
            }
            
             if(!regs.test(tel)){
               alert("请输入正确的号码");
               return false;
            }
             if(!regz.test(roomno)){
               alert("请输入正确的宿舍号");
               return false;
            }
            
            
            
            
            
            return true;
          }
        </script>
	</head>

	<body leftmargin="2" topmargin="9"
		background='<%=path%>/images/allbg.gif'>
		<form action="<%=path%>/stu!add.action" name="formAdd"
			method="post" onsubmit="return check();">
			<table width="98%" align="center" border="0" cellpadding="4"
				cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px">
				<tr bgcolor="#EEF4EA">
					<td colspan="3" background="<%=path%>/images/wbg.gif" class='title'>
						<span>学生入住登记</span>
					</td>
				</tr>

	<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						学号：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<input type="text" name="data.stuno" size="20" id="stuno"/>
					</td>
				</tr>
				<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						姓名：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<input type="text" name="data.name" size="20" id="name"/>
					</td>
				</tr>
				<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						性别：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<select name="data.sex">
						  <option value="男">男
						  </option>
						   <option value="女">女
						  </option>
						</select>
					</td>
				</tr>
				<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						所在院系：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<!--  <input name="data.department" id="department" />-->
						
						<select name="data.department" id="department">
						  <option >信息工程学院</option>
						   <option >音乐学院</option>
						    <option >环境工程学院</option>
						    <option >食品学院</option>
						    <option >美术学院</option>
						   
						</select>
						
					</td>
				</tr>
								<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						所在班级：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<input name="data.team" />
					</td>
				</tr>
								<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						联系方式：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<input name="data.tel" id="tel" />
					</td>
				</tr>
									<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						区域：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
							<select name="data.area">
						  <%
						     BaseDAO dao = new BaseDAO();
						     List<Object[]> all = dao.find("select distinct area from flat",null);
						     for(Object[] data:all){
						   %>
						     <option><%=data[0]%></option>
						   <% } %>
						</select>
					</td>
				</tr>
									<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						楼栋：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<!--  <input name="data.flat" />-->
						<select name="data.flat">
					      <option>  </option>
						  <option>1</option>
						  <option>2</option>
						  <option>3</option>
						  <option>4</option>
						  <option>5</option>
						  <option>6</option>
						  <option>7</option>
						  <option>8</option>
			
						</select>
					</td>
				</tr>
				<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						宿舍号：
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<input name="data.roomno" id="roomno" />
						<input name="data.status" value="1" type="hidden"/>
					</td>
				</tr>
				
				<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='red';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
					<td width="25%" bgcolor="#FFFFFF" align="right">
						&nbsp;
					</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<input type="submit" value="提交" />
						&nbsp;
						<input type="reset" value="重置" />
						&nbsp;
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
